/**
 * LoginBLO class.
 */
package pits.blo;

import java.util.List;
import org.apache.log4j.Logger;
import pits.dao.LoginDAO;
import pits.dto.UserDTO;

/**
 * Process business logic for Login in portlet.
 * 
 * @author ltd
 * 
 */
public class LoginBLO {
	/**
	 * log property.
	 */
	private static Logger log = Logger.getLogger("SimpleLoginBLO");

	/**
	 * DAO property.
	 */
	private LoginDAO dao = new LoginDAO();

	/**
	 * Check whether user is valid.
	 * 
	 * @param name
	 * @param pass
	 * @return
	 */
	public boolean isValidUser(String name, String pass) {
		log.debug("isValidUser.start");

		boolean res = true;
		List<UserDTO> dto = null;
		dto = dao.getUser(name, pass);

		if (dto.isEmpty()) {
			res = false;
		}

		log.debug("isValidUser.end");
		return res;
	}
}
